using System;
using System.Runtime.InteropServices;
using System.Security;
using WindowsAPI.Service;

namespace WindowsAPI
{
    [SuppressUnmanagedCodeSecurity, Dll(FileName)]
    public static class CfgMgr32
    {
        public const string FileName = "cfgmgr32.dll";

        [DllImport(FileName, SetLastError = true)]
        public static extern CR_ReturnCode CM_Request_Eject_PC();

        [DllImport(FileName, SetLastError = true)]
        public static extern CR_ReturnCode CM_Enumerate_Classes(uint ulClassIndex, out Guid ClassGuid, uint ulFlags = 0);

        [DllImport(FileName, SetLastError = true)]
        public static extern CR_ReturnCode CM_Enumerate_Classes_Ex(
            uint ulClassIndex,
            out Guid ClassGuid,
            uint ulFlags,
            IntPtr hMachine);

        [DllImport(FileName, SetLastError = true)]
        public static extern CR_ReturnCode CM_Connect_Machine(
                [MarshalAs(UnmanagedType.LPStr)] string UNCServerName,  //PCTSTR UNCServerName
                out IntPtr phMachine);
    }
}